﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace VISS.Web.Frontend.Modules.User
{
    public partial class LoginPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            UserContext userContext = LoginFactory.GetCurrentUser();
            if (userContext != null) {
                Response.Redirect("/profile?u=" + userContext.UserKey);
                return;
            }

            string email = Request.QueryString["email"];
            string url = null;
            if (Request.QueryString["url"] != null) {
                url = Request.RawUrl.Replace("/login?url=", "");
            }
            if (email != null){
                idLogin.Email = email;
            }
            if (url != null) {
                idLogin.Url = url;
            }

            // SEO
            IHeadSeo seo = this.Master as IHeadSeo;
            seo.Title = StringResources.SEO.TitleUserLogin + " | " + StringResources.SEO.TitleDefault;;
            seo.Description = StringResources.SEO.DescriptionDefault;
            seo.Keywords = StringResources.SEO.KeywordsDefault;
        }
    }
}
